package hu;

import java.util.*;

public class city_bc {
    static class uniform{
        int[] father;
        int[] sz;
        public uniform(int n) {
            father = new int[n + 1];
            sz = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                father[i] = i;
                sz[i] = 1;
            }
        }
        public int getFather(int i){
            if(father[i] == i)
                return i;
            return getFather(father[i]);
        }
        public void merge(int m, int n){
            int mRoot = getFather(m);
            int nRoot = getFather(n);
            if(mRoot != nRoot)
            {
                if(sz[mRoot] < sz[nRoot]){
                    father[mRoot] = nRoot;
                    sz[nRoot] += sz[mRoot];
                }else{
                    father[nRoot] = mRoot;
                    sz[mRoot] += sz[nRoot];
                }
            }
        }
        public int getMax(){
            int max = 0;
            for (int i = 1; i < sz.length; i++) {
                max = Math.max(max, sz[i]);
            }
            return max;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] city = new int[n - 1][2];
        for (int i = 0; i < n - 1; i++) {
            city[i][0] = sc.nextInt();
            city[i][1] = sc.nextInt();
        }
        int[] maxArray = new int[n];
        int res = Integer.MAX_VALUE;
        for (int i = 0; i < n - 1; i++) {
            uniform a = new uniform(n);
            for (int j = 0; j < n - 1; j++) {
                if(i != city[j][0] && i != city[j][1]){
                    a.merge(city[j][0], city[j][1]);
                }
            }
            maxArray[i] = a.getMax();
            res = Math.min(maxArray[i], res);
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < maxArray.length; i++) {
            if (maxArray[i] == res) {
                sb.append(i).append(" ");
            }
        }
        sb.setLength(sb.length() - 1);
        System.out.println(sb);
    }
}
/*
6
1 2
2 3
2 4
3 5
3 6


2 3
 */